package cn.school.test;

import org.apache.ibatis.session.SqlSession;

import cn.school.dao.ExamResultDao;
import cn.school.util.MyBatisUtil;
import cn.shcool.entity.ExamResult;

public class CacheTest2 {

	public static void main(String[] args) {

		SqlSession s = MyBatisUtil.get();

		ExamResultDao sdao = s.getMapper(ExamResultDao.class);
		ExamResult r = sdao.get(3L);
		if (r != null) {
			System.out.println(r);
			System.out.println("学生信息：" + r.getStudent());
		}
		MyBatisUtil.close(s);
		s = MyBatisUtil.get();
		sdao = s.getMapper(ExamResultDao.class);
		ExamResult r2 = sdao.get(3L);
		// 核心配置文件上加上 <setting name="cacheEnabled" value="true"></setting>后

		System.out.println("r2=" + r2);
		System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
		System.out.println(r == r2);
		MyBatisUtil.close(s);

	}

}
